package student.aistar.day13;

import java.io.*;

public class BufferDemo {
    public static void main(String[] args) throws Exception {
        BufferedInputStream in = null;
        BufferedOutputStream out = null;

        in = new BufferedInputStream(new FileInputStream("C:\\Users\\qinfeng\\Pictures\\广西美食\\images2.jpg"));
        out = new BufferedOutputStream(new FileOutputStream("C:\\Users\\qinfeng\\Pictures\\广西美食\\images4.jpg"));

        //虽然BufferedInputStream
        byte[] buf = new byte[3 * 1024];
        int len = -1;
        while (true){
            len = in.read(buf);

            if(len == -1)
                break;

            out.write(buf, 0 , len);
        }
        System.out.println("文件拷贝成功");

        in.close();
        out.close();
    }
}
